﻿//
// Created by harvenguo on 2024/2/23.
//

#ifndef RIDER3D_INPUT_H
#define RIDER3D_INPUT_H

#include "Define.h"
#include "component/Supposition.h"

NS_RIDER_BEGIN

    struct KeyCode {
        enum Enum {
            // 常用键
            Backspace = 0,
            Delete,
            Tab,
            Clear,
            Return,
            Pause,
            Escape,
            Space,
            // 小键盘
            Keypad0,
            Keypad1,
            Keypad2,
            Keypad3,
            Keypad4,
            Keypad5,
            Keypad6,
            Keypad7,
            Keypad8,
            Keypad9,
            KeypadPeriod,
            KeypadDivide,
            KeypadMultiply,
            KeypadMinus,
            KeypadPlus,
            KeypadEnter,
            KeypadEquals,
            // 功能键
            UpArrow,
            DownArrow,
            LeftArrow,
            RightArrow,
            Insert,
            Home,
            End,
            PageUp,
            PageDown,
            F1,
            F2,
            F3,
            F4,
            F5,
            F6,
            F7,
            F8,
            F9,
            F10,
            F11,
            F12,
            Alpha0,
            Alpha1,
            Alpha2,
            Alpha3,
            Alpha4,
            Alpha5,
            Alpha6,
            Alpha7,
            Alpha8,
            Alpha9,
            // 符号键
            Exclaim,
            DoubleQuote,
            Dollar,
            And,
            Or,
            Quote,
            LeftParen,
            RightParen,
            Asterisk,
            Plus,
            Comma,
            Minus,
            Period,
            Slash,
            Colon,
            Semicolon,
            Less,
            Equals,
            Greater,
            Question,
            At,
            LeftBracket,
            Backslash,
            RightBracket,
            Caret,
            Underscore,
            BackQuote,
            // 字母
            A,
            B,
            C,
            D,
            E,
            F,
            G,
            H,
            I,
            J,
            K,
            L,
            M,
            N,
            O,
            P,
            Q,
            R,
            S,
            T,
            U,
            V,
            W,
            X,
            Y,
            Z,
            // 键盘按键
            NumLock,
            CapsLock,
            ScrollLock,
            RightShift,
            LeftShift,
            RightControl,
            LeftControl,
            RightAlt,
            LeftAlt,
            LeftApple,
            LeftWindows,
            RightApple,
            RightWindows,
            AltGr,
            Help,
            Print,
            SysReq,
            Break,
            // 鼠标
            Mouse0,
            Mouse1,
            Mouse2,
            Mouse3,
            Mouse4,
            Mouse5,
            // 手柄按键
            JoystickButton0,
            JoystickButton1,
            JoystickButton2,
            JoystickButton3,
            JoystickButton4,
            JoystickButton5,
            JoystickButton6,
            JoystickButton7,
            JoystickButton8,
            JoystickButton9,
            JoystickButton10,
            JoystickButton11,
            JoystickButton12,
            JoystickButton13,
            JoystickButton14,
            JoystickButton15,
            Joystick1Button0,
            Joystick1Button1,
            Joystick1Button2,
            Joystick1Button3,
            Joystick1Button4,
            Joystick1Button5,
            Joystick1Button6,
            Joystick1Button7,
            Joystick1Button8,
            Joystick1Button9,
            Joystick1Button10,
            Joystick1Button11,
            Joystick1Button12,
            Joystick1Button13,
            Joystick1Button14,
            Joystick1Button15,
            Joystick2Button0,
            Joystick2Button1,
            Joystick2Button2,
            Joystick2Button3,
            Joystick2Button4,
            Joystick2Button5,
            Joystick2Button6,
            Joystick2Button7,
            Joystick2Button8,
            Joystick2Button9,
            Joystick2Button10,
            Joystick2Button11,
            Joystick2Button12,
            Joystick2Button13,
            Joystick2Button14,
            Joystick2Button15,
            Joystick3Button0,
            Joystick3Button1,
            Joystick3Button2,
            Joystick3Button3,
            Joystick3Button4,
            Joystick3Button5,
            Joystick3Button6,
            Joystick3Button7,
            Joystick3Button8,
            Joystick3Button9,
            Joystick3Button10,
            Joystick3Button11,
            Joystick3Button12,
            Joystick3Button13,
            Joystick3Button14,
            Joystick3Button15,
        };
    };

    struct TouchEvent {
        enum Type {
            Click,
            LongClick,
            Drag
        };
        Type type;
        NdcPoint point;
    };

    class InputManager {
    public:
        bool IsKeyDown(KeyCode::Enum& code);

        bool IsKeyLongPress(KeyCode::Enum& code);

        bool IsKeyUp(KeyCode::Enum& code);
    };

NS_RIDER_END

#endif //RIDER3D_INPUT_H
